﻿#pragma once
#include<iostream>
#include<stdbool.h>
#include<assert.h>
using namespace std;
class Date
{
public:
	Date(int year = 1900, int month = 1, int day = 1);
	void Printf();
	int GetMonthDay(int year, int month)
	{
		assert(month > 0 && month < 13);
		static int monthDayArray[13] = { -1, 31, 28, 31, 30, 31, 30,
		31, 31, 30, 31, 30, 31 };
		// 365天 5h +
		if (month == 2 && ((year % 4 == 0 && year % 100 != 0) || (year
			% 400 == 0)))
		{
			return 29;
		}
		else
		{
			return monthDayArray[month];
		}
	}

	bool operator<(const Date& d);
	bool operator<=(const Date& d);
	bool operator>(const Date& d);
	bool operator>=(const Date& d);
	bool operator==(const Date& d);
	bool operator!=(const Date& d);
	Date& operator+=(int day);
	Date operator+(int day);
	Date& operator-=(int day);
	Date operator-(int day);
private:
	// 为了区分成员变量，⼀般习惯上成员变量
	// 会加⼀个特殊标识，如_ 或者 m开头
	int _year; // year_ m_year
	int _month;
	int _day;
};